//派发器

//导入逻辑
import reducer from '../reducers/calculator';
import {
  SET_NUMBER,
  CHANGE_METHOD
} from '../actions/calculator';

export default (ctx) => {
  // console.log(ctx.$data);

  const {
    setNumber,
    changeMethod
  } = reducer(ctx.$data);

  return function (type, ...args) {
    switch (type) {
      case SET_NUMBER:
        ctx.result = setNumber(...args);
      case CHANGE_METHOD:
        ctx.result = changeMethod(...args);
      default:
        break;
    }
  }
}